package no.ntnu.fp.handlers;

import no.ntnu.fp.client.Client;
import no.ntnu.fp.handler.Handler;
import no.ntnu.fp.messages.Message;
import no.ntnu.fp.messages.impl.MeetingDeletedMessage;
import no.ntnu.fp.model.CalendarModel;
import no.ntnu.fp.model.Meeting;

public class MeetingDeletedHandler implements Handler {
	private final CalendarModel calendarModel;
	
	public MeetingDeletedHandler(CalendarModel calendarModel) {
		this.calendarModel = calendarModel;
	}

	@Override
	public void handleMessage(Message message) {
		MeetingDeletedMessage meetingDeletedMessage
											= (MeetingDeletedMessage) message;
		
		Meeting meeting = meetingDeletedMessage.getMeeting();
		
		calendarModel.deleteMeeting(Client.getEmployee(), meeting);
		calendarModel.deleteMeeting(meeting.getEmployee(), meeting);
	}

}
